package org.util.aop;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.springframework.aop.framework.ProxyFactory;

public class Test {
	@org.junit.Test
	public void proxyLoginTest() {
		ProxyFactory factory = new ProxyFactory();
		Advisor advisor = new Advisor();
		factory.addAdvice(advisor.new BeforeAdvice1());
		factory.addAdvice(advisor.new BeforeAdvice2());
		factory.addAdvice(advisor.new AfterAdvice1());
		factory.addAdvice(advisor.new AfterAdvice2());
		LoginService target = new LoginServiceImpl();
		factory.setTarget(target);
		factory.setProxyTargetClass(false);
		factory.setInterfaces(new Class[] { LoginService.class });

		LoginService service = (LoginService) factory.getProxy();
		System.out.println(service.login("fuck"));
	}

}
